-
Notifications
You must be signed in to change notification settings - Fork 13k
Enhance type argument completions #62170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
b9800de
to
d5bbf02
Compare
1 similar comment
@i-ayushh18 I don't know if this is intentional, but it seems that you have a bot which is spamming a bunch of nonsense comments across many pull requests. If it is intentional, please cut it out. |
Sorry for the thing,a bot was responsible for that,will suspend that at latest! |
I have tested this changes locally, and it works well for me. Looking forward to seeing it merged and released soon. |
Previously, `getTypeArgumentConstraint` could only find constraints for type arguments of generic type instantiations. Now it additionally supports type arguments of the following expression kinds: - function calls - `new` expressions - tagged templates - JSX expressions - decorators - instantiation expressions
e8f8ef9
to
d3e5ece
Compare
@typescript-bot pack this |
Hey @jakebailey, I've packed this into an installable tgz. You can install it for testing by referencing it in your
and then running There is also a playground for this build and an npm module you can use via |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I'm concerned, this seems fine to me.
Thanks for reviewing/merging! |
#43526 implemented limited support for completions within type arguments, but only for type arguments of types (not values like generic function calls), and only for specific locations within the type literal (e.g. property names of object types). This pull request generalizes type argument completions such that suggestions now appear in many more scenarios, including:
f<…>()
)new
expressions (new Foo<…>()
)tag<…>`blah`
)<Component<…>/>
)@decorator<…> class {}
)f<…>
)Foo<{ x: … }>
)Foo<"…">
)Foo<[…]>
)Suggested completions are derived from the relevant type parameter's constraint.
This pull request subsumes #61758 and includes the additional enhancements mentioned in that pull request's description.
Fixes #61751.
Fixes #56299.
Fixes #52898.
Fixes #34771.